"""
批量修改文件名称
"""
import os

def batch_rename(folder_name):
    # 获取文件夹下所有文件
    file_names = os.listdir(folder_name)

    # 跳转到当前目录下面操作
    os.chdir(folder_name)

    # 循环对文件重命名
    i = 1
    for file_name in file_names:
        os.rename(file_name, str(i) + file_name)
        i += 1

def batch_rename1(folder_name):
    # 获取文件夹下所有文件
    file_names = os.listdir(folder_name)

    # 循环对文件重命名
    i = 1
    for file_name in file_names:
        os.rename("./" + folder_name + "/" +file_name, "./" + folder_name + "/" + str(i) + file_name)
        i += 1


# 输入文件夹名称
folder_name = input("请输入需要修改的文件夹：")
batch_rename1(folder_name)